/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package query.parser.entities;

import java.util.HashMap;
import java.util.Map;
import query.parser.IExpression;
import query.parser.SelectStatement;

/**
 *
 * @author dzb
 */
public class Join extends AliasedEntity {


	public enum JoinType {
        Join,
        InnerJoin,
        LeftJoin,
        LeftOuterJoin,
        RightJoin,
        RightOuterJoin,
        FullJoin,
        FullOuterJoin,
        CrossJoin
    }

	private String name;
	private JoinType type;
	private IExpression condition;
	protected Map<JoinType, String> joinTypes = new HashMap<JoinType, String>();
	private SelectStatement st;
	
	public Join() {

	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the type
	 */
	public JoinType getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(JoinType type) {
		this.type = type;
	}

	/**
	 * @return the condition
	 */
	public IExpression getCondition() {
		return condition;
	}

	/**
	 * @param condition the condition to set
	 */
	public void setCondition(IExpression condition) {
		this.condition = condition;
	}

	/**
	 * @return the SelectStatement
	 */
	public SelectStatement getSelectStatement() {
		return st;
	}

	/**
	 * @param SelectStatement the SelectStatement to set
	 */
	public void setSelectStatement(SelectStatement st) {
		this.st = st;
	}
	
	@Override
	public String getValue() {
		 return String.format("%s (", joinTypes.get(type));
	}

}
